<template>
  <Slide>
    <div v-if="showFlag ==true">
      <router-link to="/denglu" class="flex items-center mb-10">
        <navigate></navigate>
        <img v-if="image" :src="image" alt="avatar" class="rounded-full w-12 h-12">
        <div class="text-gray-500 ml-6 hover:text-gray-300">{{deng}}</div>
      </router-link>
    </div>
    <div v-else-if="showFlag ==false">
      <router-link to="/xiugai" class="flex items-center mb-10">
        <navigate></navigate>
        <img v-if="image" :src="image" alt="avatar" class="rounded-full w-12 h-12">
        <div class="text-gray-500 ml-6 hover:text-gray-300">{{deng}}</div>
      </router-link>
    </div>

    <router-link to="/list">
      <svg fill="currentColor" viewBox="0 0 24 24" width="24" height="24"><path class="heroicon-ui" d="M16.32 14.9l5.39 5.4a1 1 0 0 1-1.42 1.4l-5.38-5.38a8 8 0 1 1 1.41-1.41zM10 16a6 6 0 1 0 0-12 6 6 0 0 0 0 12z"></path></svg>
        <span>搜索</span>
    </router-link>

    <router-link to="/">
      <svg fill="currentColor" viewBox="0 0 24 24" width="24" height="24"><path class="primary" d="M9 22H5a1 1 0 0 1-1-1V11l8-8 8 8v10a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1v-4a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1v4a1 1 0 0 1-1 1zm3-9a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"></path><path class="secondary" d="M12.01 4.42l-8.3 8.3a1 1 0 1 1-1.42-1.41l9.02-9.02a1 1 0 0 1 1.41 0l8.99 9.02a1 1 0 0 1-1.42 1.41l-8.28-8.3z"></path></svg>
        <span>主页</span>
    </router-link>

    <router-link to="/cart">
      <i class="el-icon-shopping-cart-2"></i>
        <span>购物车</span>
    </router-link>

    <router-link to="/bigorder">
      <i class="el-icon-document"></i>
        <span>订单</span>
    </router-link>

    <router-link to="/xiugai">
      <i class="el-icon-setting"></i>
        <span>设置</span>
    </router-link>

    <router-link to="/tuichu">
      <i class="el-icon-error"></i>
      <span>退出</span>
    </router-link>

    <div class="ml-8">
      <img src="@/assets/disneyplus_logo.svg">
    </div>
  </Slide>
</template>

<script>
import { Slide } from 'vue-burger-menu'

export default {
    provide(){
        return{
        }
    },
    created(){
        if(localStorage.getItem("Authorization")==null || localStorage.getItem("Authorization")==""){
            this.image="https://touxiang-1.oss-cn-shanghai.aliyuncs.com/2021-07/17/3991463_204828364355_2.jpg"
            this.deng="请登录"
        }else {
            this.image=JSON.parse(localStorage.getItem("Authorization")).userImg
            this.deng=JSON.parse(localStorage.getItem("Authorization")).userName
            this.showFlag=false
        }
    },
    components: {
        Slide,


    },
    data() {
        return {
            image:"",
            deng:"",
            showFlag:true
        }
    },

}
</script>

